<?php
namespace App\Http\Controllers\Home;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Session;
class LoginController extends \App\Http\Controllers\Controller {
    public function index() {
        return view('home.login.index');
    }
    /**
     * 执行用户登录操作
     * @param Request $request
     */
    public function login(Request $request) {
        if ($request->input('code')) {
            $user = \App\Models\User::regUser($request->input('code'));
            Session::put('home', $user);
            Session::save();
            return redirect(url('home/login/index'));
        } else {
            return redirect(url('home/login/index'));
        }
    }
}

